from pprint import pprint
class Person:

    def __init__(self, name, age):
        self.name = name
        self.age = age # self.age here is a class attribute, special occasion!

    def set_age(self, age):
        if age <= 0:
            raise ValueError("The age must be positive")
        self._age = age

    def get_age(self):
        return self._age
    
    age = property(fget=get_age, fset=set_age) # added when it is needed

john = Person('John', 18)
pprint(john.__dict__)
pprint(Person.__dict__)